
#include "UdpServer.hpp"
#include "User.hpp"



int main()
{
    std::shared_ptr<UserManager> p_userManager = std::make_shared<UserManager>();
    //传递回调函数，处理业务
    std::shared_ptr<UdpServer> p_server = std::make_shared<UdpServer>();
    p_server->RegisterFunc([&p_userManager](InetAddr& id){p_userManager->AddUesr(id);},
                        [&p_userManager](int socket,std::string message){ p_userManager->Router(socket,message);},
                        [&p_userManager](InetAddr &id){ p_userManager->DeleteUserr(id);}
    );


    //[&p_userManager](int socket,std::string message){p_userManager->Router(socket,message);}
    //1. 服务器初始化
    p_server->Init();

    //2. 服务器启动
    p_server->Start();



    return 0;
}